<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
	<form class="form-horizontal business-form"id="credit-infoe">
		<div class="current-state-bno">
			<div class="submit-buttonleft">
				<button id="tcsqSave" class="btn-danger-my btn  btn-primary" type="button" onclick="tcsqSaveOrUpdate();">保存</button>
				<button id="tcsqUpdate" class="btn-danger-my btn  btn-primary" type="button" onclick="tcsqSaveOrUpdate();">修改</button>
			</div>
		</div>
		<div class="business-manwife">申请拖车</div>
		<div class="padding-nono">
			<table cellpadding="0" cellspacing="0" border="0" class="buyinfor-table">
				<tr>
					<td align="left"  valign="top"><label class="control-label np">信息备注：</label></td>
					<td align="left">
						<input type="hidden" id="tcsqId" /> 
						<input type="hidden" id="tcRecordId" /> 
						<textarea id="tcsqRemarks" name="" rows="3" cols="150" class="form-control"></textarea>
					</td>
				</tr>
			</table>
		</div>	
		<div class="business-manwife clear-both">经办信息</div>
		<div class="padding-nono">
			<table cellpadding="0" cellspacing="0" border="0"
				class="buyinfor-table">
				<tr>
					<td align="right"><label class="control-label np">经办人：</label></td>
					<td><input class="form-control" type="text" id="tcsqjb_operator" name="" readonly="readonly" value="${current_user_key.uname}"></td>
					<td align="right"><label class="control-label np">经办时间：</label></td>
					<td><input id="tcsqjb_operatorTime" readonly="readonly" type="text" class="form-control" />
					</td>
				</tr>
			</table>
		</div>
	</form>
	
	<%@include file="/jsp/comm_js_include.jsp"%>
	<script type="text/javascript">
	var tcsqSaveOrUpdate=function(){
    	var data={};
    	var url='${basePath}/DhOverdueTrailerRecordController/insert';
    	var tcRecordId=$("#tcRecordId").val();
    	if(tcRecordId!=null &&tcRecordId!=""){
    		data.id=$("#tcRecordId").val();
    		url='${basePath}/DhOverdueTrailerRecordController/modify';
    	}else{
        	data.creatorName=$("#tcsqjb_operator").val();
        	data.jbDate=$("#tcsqjb_operatorTime").val();
        	data.creator="${current_user_key.id}";
    	}
    	data.remarkApply=$("#tcsqRemarks").val();
    	data.busiId= $.getUrlData("busiId");
    	data.cusId= $.getUrlData("cusId");
    	data.cusName=$.getUrlData("cusName");
    	data.statusTrailer=10;
    	$.dpAjax({
    		show:false,
	    		url:url,
    			data:data,
    			success: function(datas){
    				layer.msg('执行成功！', {icon: 6});
				    return;
                }
	    	});
    }
	
	var getTcsqDataById=function(){
    	var data={};
		data.busiId=$.getUrlData("busiId");
		data.orderSql="created desc";
		$("#tcsqUpdate").hide();
		$.dpAjax({
			show:false,
    		url:'${basePath}/DhOverdueTrailerRecordController/list',
			data:data,
			success: function(datas){
				  var data=datas.result.rows;
				  if(data.length>0){
					  $("#tcRecordId").val(data[0].replaceId);
					  $("#tcsqRemarks").val(data[0].remarkApply);
					  $("#tcsqjb_operatorTime").val(data[0].jbDate);
					  $("#tcsqUpdate").show();
					  $("#tcsqSave").hide();
					  return;
				  }
            }
    	});
    }
    
	</script>